<template>
  <div id="app">
    <div class="header"></div>
    <div class="container">
      <div class="sidebar">
        <Menuitem v-for="(menu,index) in menus" :key="index" :menu="menu" />

        <!-- <div class="menu-item">
          <router-link to="/userlist">用户列表</router-link>
        </div>

        <div class="menu-item" @click="menuItemClick">
          <router-link to="/gamelist">游戏列表</router-link>
          <div class="menu-item-expanded" v-bind:style="unfold">
            <div>one</div>
            <div>one</div>
            <div>one</div>
          </div>
        </div>
        <div class="menu-item">
          <router-link to="/score">分数统计</router-link>
        </div> -->

      </div>
      <div class="content">
        <router-view/>
      </div>
    </div>
  </div>
</template>

<script>
import Menuitem from "./components/Menuitem";
export default {
  name: "App",
  components:{
    Menuitem
  },
  data() {
    return {
      menus:[
        {
          menuText:'用户',
          link:[
            {linkTo:'/users',linkName:'用户列表'},
          ]
        },
        {
          menuText:'游戏',
          link:[
            {linkTo:'/games',linkName:'游戏列表'},
            // {linkTo:'/game_level',linkName:'游戏关卡列表'},
          ]
        },
        {
          menuText:'分数',
          link:[
            {linkTo:'/score',linkName:'分数统计'},
          ]
        }
      ],
      menuItemUnfold: false,
      defaultIndex: 0,
    }
  },
  computed: {
    // unfold() {
    //   if (this.menuItemUnfold) {
    //     return { height: '120px' }
    //   } else {
    //     return { height: '0' }
    //   }

    // }
  },
  methods: {
    // menuItemClick(index) {
    //   // this.defaultIndex=index;
    //   this.menuItemUnfold = !this.menuItemUnfold;
    // }
  }
};
</script>

<style lang='scss'>
html,
body {
  height: 100%;
  width: 100%;
  margin: 0;padding: 0;
  overflow: hidden;
}
#app {
  height: 100%;
  width: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  .header {
    height: 48px;
    background: #333;
    color: #fff;
  }
  .container {
    flex: 1;
    display: flex;
    flex-direction: row;
    .sidebar {
      height: 100%;
      width: 220px;
      min-width: 120px;
      background: #eeeeee;
    }
    .content {
      flex: 1;
    }
  }
}
// .menu-item {
//   min-height: 40px;
//   line-height: 40px;
//   text-indent: 1rem;
//   border-bottom: 1px solid #ddd;
//   color: #333;
//   cursor: pointer;
//   user-select: none;
//   transition: all 0.2s;
//   &:hover {
//     background: #ddd;
//   }
//   .menu-item-expanded {
//     height: 0;
//     overflow: hidden;
//     transition: all 0.3s;
//   }
// }
</style>
